home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 52
/
Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso
/
Aminet
/
util
/
moni
/
Scout-src.lha
/
source
/
scout_cat.c
< prev
next >
Wrap
C/C++ Source or Header
|
2002-09-16
|
14KB
|
422 lines
/****************************************************************
This file was created automatically by `FlexCat 2.6'
from "Scout.cd".
Do NOT edit by hand!
****************************************************************/
/****************************************************************
This file uses the auto initialization possibilities of
Dice, gcc and SAS/C, respectively.
Dice does this by using the keywords __autoinit and
__autoexit, SAS uses names beginning with _STI or
_STD, respectively. gcc uses the asm() instruction,
to emulate C++ constructors and destructors.
Using this file you don't have *all* possibilities of
the locale.library. (No Locale or Language arguments are
supported when opening the catalog. However, these are
*very* rarely used, so this should be sufficient for most
applications.
****************************************************************/
/*
Include files and compiler specific stuff
*/
#include <exec/memory.h>
#include <libraries/locale.h>
#include <libraries/iffparse.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/locale.h>
#include <proto/utility.h>
#include <proto/iffparse.h>
#include <stdlib.h>
#include <string.h>
#include "Scout_cat.h"
/*
Variables
*/
struct FC_String Scout_Strings[171] = {
{ (STRPTR) "Can't open input.device!\n", 0 },
{ (STRPTR) "Can't open timer.device!\n", 1 },
{ (STRPTR) "No HOST specified!\n", 2 },
{ (STRPTR) "Please start a TCP/IP stack first (i.e. AmiTCP/Genesis or Miami(Dx))!\n", 3 },
{ (STRPTR) "Can't create application!\n", 4 },
{ (STRPTR) "Can't send script %s to port \"%s\"!\n", 5 },
{ (STRPTR) "***Break\n", 6 },
{ (STRPTR) "Can't initialize TCP/IP stack!\n", 100 },
{ (STRPTR) "Password:", 101 },
{ (STRPTR) "Can't get password!\n", 102 },
{ (STRPTR) "Can't connect to server!\n", 103 },
{ (STRPTR) "Can't create socket!\n", 104 },
{ (STRPTR) "Can't find host \"%s\"!\n", 105 },
{ (STRPTR) "Unknown option", 106 },
{ (STRPTR) "Wrong password!\n", 107 },
{ (STRPTR) "You don't have root privileges!\n", 108 },
{ (STRPTR) "Unknown user!\n", 109 },
{ (STRPTR) "No \"BEGIN\" received!\n", 110 },
{ (STRPTR) "Error occured!", 111 },
{ (STRPTR) "Continue", 112 },
{ (STRPTR) "_Continue", 200 },
{ (STRPTR) "\033c\n"\
"%s\n"\
"%s\n"\
"\n"\
"%s\n"\
"All Rights Reserved\n"\
"\n"\
"This program is \033bFreeware\033n.\n"\
"EMail: %s\n"\
"\n"\
"ARexx port name: %s\n", 201 },
{ (STRPTR) "_Update", 300 },
{ (STRPTR) "Pr_int", 301 },
{ (STRPTR) "_Remove", 302 },
{ (STRPTR) "_Priority", 303 },
{ (STRPTR) "_More", 304 },
{ (STRPTR) "_Close", 305 },
{ (STRPTR) "E_xit", 306 },
{ (STRPTR) "_Functions", 307 },
{ (STRPTR) "Yes|No", 308 },
{ (STRPTR) "Once|All|Cancel", 309 },
{ (STRPTR) "_Ok", 310 },
{ (STRPTR) "_Cancel", 311 },
{ (STRPTR) "<none>", 312 },
{ (STRPTR) "Do you really want to remove directory\n"\
"\"%s\" from assign \"%s\"?", 400 },
{ (STRPTR) "Do you really want to assign \"%s\"?", 401 },
{ (STRPTR) "Do you really want to remove class\n"\
"\"%s\"?", 500 },
{ (STRPTR) "Can't remove INTERNAL commands!", 600 },
{ (STRPTR) "Can't remove SYSTEM commands!", 601 },
{ (STRPTR) "Can't remove DISABLED commands!", 602 },
{ (STRPTR) "Do you really want to remove command\n"\
"\"%s\"?", 603 },
{ (STRPTR) "_Appear", 700 },
{ (STRPTR) "_Disappear", 701 },
{ (STRPTR) "_Enable", 702 },
{ (STRPTR) "Di_sable", 703 },
{ (STRPTR) "_Kill", 704 },
{ (STRPTR) "List_Chg", 705 },
{ (STRPTR) "Uni_que", 706 },
{ (STRPTR) "Do you really want to remove commodity\n"\
"\"%s\"?", 707 },
{ (STRPTR) "Do you really want to remove device\n"\
"\"%s\"?", 800 },
{ (STRPTR) "Supported commands:", 801 },
{ (STRPTR) "[identify.library required]", 900 },
{ (STRPTR) "Do you really want to close font\n"\
"\"%s\"?", 1000 },
{ (STRPTR) "Do you really want to remove font\n"\
"\"%s\"?", 1001 },
{ (STRPTR) "Sorry, the count of accessors is already zero!", 1002 },
{ (STRPTR) "Sorry, the count of accessors is not zero!", 1003 },
{ (STRPTR) "<no .fd file>", 1100 },
{ (STRPTR) "<no jmp>", 1101 },
{ (STRPTR) "<no entry in .fd file>", 1102 },
{ (STRPTR) "Do you really want to remove input handler\n"\
"\"%s\"?", 1200 },
{ (STRPTR) "Sorry, I can't remove an interrupt handler!", 1300 },
{ (STRPTR) "Do you really want to remove interrupt server\n"\
"\"%s\"?", 1301 },
{ (STRPTR) "Do you really want to remove library\n"\
"\"%s\"?", 1400 },
{ (STRPTR) "Do you really want to close library\n"\
"\"%s\"?", 1401 },
{ (STRPTR) "Sorry, the open count is already zero!", 1402 },
{ (STRPTR) "Pattern:", 1500 },
{ (STRPTR) "%lD shown, %lD hidden", 1501 },
{ (STRPTR) "%lD shown, %lD hidden. Done.", 1502 },
{ (STRPTR) "Do you really want to remove lock\n"\
"\"%s\"?", 1503 },
{ (STRPTR) "Yes|All|No|Abort", 1504 },
{ (STRPTR) "Do you really want to remove lowmemory handler\n"\
"\"%s\"?", 1600 },
{ (STRPTR) "dummy", 1700 },
{ (STRPTR) "read only", 1800 },
{ (STRPTR) "validating", 1801 },
{ (STRPTR) "read/write", 1802 },
{ (STRPTR) "no disk", 1803 },
{ (STRPTR) "unreadable", 1804 },
{ (STRPTR) "Do you really want to remove port\n"\
"\"%s\"?", 1900 },
{ (STRPTR) "Change priority", 2000 },
{ (STRPTR) "Min:", 2001 },
{ (STRPTR) "Max:", 2002 },
{ (STRPTR) "Old:", 2003 },
{ (STRPTR) "New:", 2004 },
{ (STRPTR) "\033c Please select a new priority for \n"\
"\"%s\"", 2005 },
{ (STRPTR) "dummy", 2100 },
{ (STRPTR) "Do you really want to remove resource\n"\
"\"%s\"?", 2200 },
{ (STRPTR) "MCOMPAT_MIXED: can share display with other MIXED", 2300 },
{ (STRPTR) "MCOMPAT_SELF: can share only within monitor", 2301 },
{ (STRPTR) "MCOMPAT_NOBODY: only one viewport", 2302 },
{ (STRPTR) "_Obtain", 2400 },
{ (STRPTR) "Re_lease", 2401 },
{ (STRPTR) "Do you really want to obtain semaphore\n"\
"\"%s\"?", 2402 },
{ (STRPTR) "Do you really want to release semaphore\n"\
"\"%s\"?", 2403 },
{ (STRPTR) "Sorry, the semaphore's nest count is already zero!", 2404 },
{ (STRPTR) "Do you really want to remove semaphore\n"\
"\"%s\"?", 2405 },
{ (STRPTR) "Send signal", 2500 },
{ (STRPTR) "Signal:", 2501 },
{ (STRPTR) "SigWait:", 2502 },
{ (STRPTR) "\033c Please select the signal for \n"\
"\"%s\"", 2503 },
{ (STRPTR) "dummy", 2600 },
{ (STRPTR) "_Freeze", 2700 },
{ (STRPTR) "_Activate", 2701 },
{ (STRPTR) "_Signal", 2702 },
{ (STRPTR) "_Break", 2703 },
{ (STRPTR) " Secs:", 2704 },
{ (STRPTR) "off", 2705 },
{ (STRPTR) "full", 2706 },
{ (STRPTR) "in %", 2707 },
{ (STRPTR) "Do you really want to remove %s\n"\
"\"%s\"?", 2708 },
{ (STRPTR) "Also remove ports, window, etc allocated by task\n"\
"\"%s\"?", 2709 },
{ (STRPTR) "Sorry, I can't find that task!", 2710 },
{ (STRPTR) "Can't install patch semaphore!", 2711 },
{ (STRPTR) "Found old patch semaphore (V%ld.%ld)!\n"\
"I will replace this one by a new one (V%ld.%ld)!", 2712 },
{ (STRPTR) "<no task>", 2713 },
{ (STRPTR) "frozen", 2714 },
{ (STRPTR) "added", 2715 },
{ (STRPTR) "running", 2716 },
{ (STRPTR) "ready", 2717 },
{ (STRPTR) "waiting", 2718 },
{ (STRPTR) "wait abort", 2719 },
{ (STRPTR) "wait child", 2720 },
{ (STRPTR) "wait sema", 2721 },
{ (STRPTR) "wait intui", 2722 },
{ (STRPTR) "wait net", 2723 },
{ (STRPTR) "wait dos", 2724 },
{ (STRPTR) "wait break C", 2725 },
{ (STRPTR) "wait break D", 2726 },
{ (STRPTR) "wait break E", 2727 },
{ (STRPTR) "wait break F", 2728 },
{ (STRPTR) "suspended", 2729 },
{ (STRPTR) "except", 2730 },
{ (STRPTR) "removed", 2731 },
{ (STRPTR) "invalid", 2732 },
{ (STRPTR) "< ??? >", 2733 },
{ (STRPTR) "task", 2734 },
{ (STRPTR) "interrupt", 2735 },
{ (STRPTR) "device", 2736 },
{ (STRPTR) "msgport", 2737 },
{ (STRPTR) "message", 2738 },
{ (STRPTR) "freemsg", 2739 },
{ (STRPTR) "replymsg", 2740 },
{ (STRPTR) "resource", 2741 },
{ (STRPTR) "library", 2742 },
{ (STRPTR) "memory", 2743 },
{ (STRPTR) "softint", 2744 },
{ (STRPTR) "font", 2745 },
{ (STRPTR) "process", 2746 },
{ (STRPTR) "semaphore", 2747 },
{ (STRPTR) "signalsem", 2748 },
{ (STRPTR) "bootnode", 2749 },
{ (STRPTR) "kickmem", 2750 },
{ (STRPTR) "graphics", 2751 },
{ (STRPTR) "deathmessage", 2752 },
{ (STRPTR) "user", 2753 },
{ (STRPTR) "extended", 2754 },
{ (STRPTR) "unknown", 2755 },
{ (STRPTR) "< ??? >", 2756 },
{ (STRPTR) "dummy", 2800 },
{ (STRPTR) "dummy", 2900 },
{ (STRPTR) "To _Front", 3000 },
{ (STRPTR) "Do you really want to close screen\n"\
"\"%s\"?", 3001 },
{ (STRPTR) "Do you really want to close window\n"\
"\"%s\"?", 3002 },
{ (STRPTR) "Neither SaferPatches nor SetMan nor PatchControl is installed!", 3100 },
{ (STRPTR) "Wrong SetMan version!\n"\
"wanted: 0x%08lx, is: 0x%08lx", 3101 },
{ (STRPTR) "Disabling patches, even a complete patch list of\n"\
"related patches, is a potentially dangerous operation.\n"\
"Are you sure you want to continue?", 3102 },
{ (STRPTR) "disabled", 3103 },
{ (STRPTR) "removed", 3104 },
{ (STRPTR) "active", 3105 },
{ (STRPTR) "Can't open %s version %ld!", 3200 },
{ (STRPTR) "Do you really want to remove reset handler\n"\
"\"%s\"?", 3300 }
};
STATIC struct Catalog *ScoutCatalog = NULL;
#ifdef LOCALIZE_V20
STATIC STRPTR ScoutStrings = NULL;
STATIC ULONG ScoutStringsSize;
#endif
VOID CloseScoutCatalog(VOID)
{
if (ScoutCatalog) {
CloseCatalog(ScoutCatalog);
}
#ifdef LOCALIZE_V20
if (ScoutStrings) {
FreeMem(ScoutStrings, ScoutStringsSize);
}
#endif
}
VOID OpenScoutCatalog(VOID)
{
if (LocaleBase) {
if ((ScoutCatalog = OpenCatalog(NULL, (STRPTR) "Scout.catalog",
OC_BuiltInLanguage, "english",
OC_Version, 3,
TAG_DONE))) {
struct FC_String *fc;
int i;
for (i = 0, fc = Scout_Strings; i < 171; i++, fc++) {
fc->msg = GetCatalogStr(ScoutCatalog, fc->id, (STRPTR) fc->msg);
}
}
}
}
#if defined(__GNUC__)
__asm (" .text; .stabs \"___CTOR_LIST__\",22,0,0,__STIOpenScoutCatalog");
__asm (" .text; .stabs \"___DTOR_LIST__\",22,0,0,__STDCloseScoutCatalog");
#endif
#ifdef LOCALIZE_V20
VOID InitScoutCatalog(STRPTR language)
{
struct IFFHandle *iffHandle;
/*
** Use iffparse.library only, if we need to.
*/
if (LocaleBase || !IFFParseBase || !language ||
Stricmp(language, "english") == 0) {
return;
}
if ((iffHandle = AllocIFF())) {
char path[128]; /* Enough to hold 4 path items (dos.library 3.1) */
strcpy(path, "PROGDIR:Catalogs");
AddPart((STRPTR) path, language, sizeof(path));
AddPart((STRPTR) path, "Scout.catalog", sizeof(path));
if (!(iffHandle->iff_Stream = Open((STRPTR) path, MODE_OLDFILE))) {
strcpy(path, "LOCALE:Catalogs");
AddPart((STRPTR) path, language, sizeof(path));
AddPart((STRPTR) path, language, sizeof(path));
iffHandle->iff_Stream = Open((STRPTR) path, MODE_OLDFILE);
}
if (iffHandle->iff_Stream) {
InitIFFasDOS(iffHandle);
if (!OpenIFF(iffHandle, IFFF_READ)) {
if (!PropChunk(iffHandle, MAKE_ID('C','T','L','G'),
MAKE_ID('S','T','R','S'))) {
struct StoredProperty *sp;
int error;
for (;;) {
if ((error = ParseIFF(iffHandle, IFFPARSE_STEP))
== IFFERR_EOC) {
continue;
}
if (error) {
break;
}
if ((sp = FindProp(iffHandle, MAKE_ID('C','T','L','G'),
MAKE_ID('S','T','R','S')))) {
/*
** Check catalog and calculate the needed
** number of bytes.
** A catalog string consists of
** ID (LONG)
** Size (LONG)
** Bytes (long word padded)
*/
LONG bytesRemaining;
LONG *ptr;
ScoutStringsSize = 0;
bytesRemaining = sp->sp_Size;
ptr = (LONG *) sp->sp_Data;
while (bytesRemaining > 0) {
LONG skipSize, stringSize;
ptr++; /* Skip ID */
stringSize = *ptr++;
skipSize = ((stringSize+3) >> 2);
ScoutStringsSize += stringSize+1; /* NUL */
bytesRemaining -= 8 + (skipSize << 2);
ptr += skipSize;
}
if (!bytesRemaining &&
(ScoutStrings = AllocMem(ScoutStringsSize, MEMF_ANY))) {
STRPTR sptr;
bytesRemaining = sp->sp_Size;
ptr = (LONG *) sp->sp_Data;
sptr = ScoutStrings;
while (bytesRemaining) {
LONG skipSize, stringSize, id;
struct FC_String *fc;
int i;
id = *ptr++;
stringSize = *ptr++;
skipSize = ((stringSize+3) >> 2);
CopyMem(ptr, sptr, stringSize);
bytesRemaining -= 8 + (skipSize << 2);
ptr += skipSize;
for (i = 0, fc = Scout_Strings; i < 171; i++, fc++) {
if (fc->id == id) {
fc->msg = sptr;
}
}
sptr += stringSize;
*sptr++ = '\0';
}
}
break;
}
}
}
CloseIFF(iffHandle);
}
Close(iffHandle->iff_Stream);
}
FreeIFF(iffHandle);
}
}
#endif